<!-- 内容 begin  -->
<style>
.choice-list li{display:block;}
</style>
<!-- 页面样式 END -->

<!-- 页面js BEGIN -->
<script>
	$(function(){
		$("#tog_explain").toggle(function(){
			$("#vote_explain_button").show("slow");
			$(this).text("{:L(add_0003)}");
		},function(){
			$("#vote_explain_button").hide("slow");
			$(this).text("{:L(add_0002)}");
		});

		//截止时间
//		$("#vote_year").attr('selected',true);
//		$("#vote_month option[value='{$date.month}']").attr('selected',true);
//		$("#vote_day option[value='{$date.day}']").attr('selected',true);
//		$("#vote_hour option[value='{$date.hour}']").attr('selected',true);
	});
	var flag = 1;
	var num_limit=10;
	function check_vote() {
		var title = $.trim($("#vote_title").val());
		if(!title){
			alert("{:L(add_0001)}");
			return false;
		}
		flag = 0;
		$(".vote_opt").each(function (i) {
			if($.trim($(this).val())) flag++;									
		})
		if(flag<2){
			alert("{:L(add_0032)}");
			return false;
		}
		var type = $( '#vote_type' ).val();
		if( type > flag-1 ){
		  alert( '{:L(add_0033)}' ) ;
		  return false;
		}
	}

	function more(){
		var new_vote = $( '#vote_default' ).clone();
		if( flag == 1 ){
			$( '.vote_opt' ).each( function( i ){
				flag++;
			});
		}
		new_vote.children( '.alR' ).html( "{:L(add_0017)}"+flag+"：" );
		new_vote.find( 'input' ).val( '' );
		flag++;
		$( '#vote_more_options' ).before( new_vote );
		// $("#more_options").show();
		// $("#add_more").hide();
		num_limit--;
		if( num_limit == 0 ){
			$( '#add_more' ).hide();
			return;
		}
	}
</script>
<!-- 页面js END -->

<div class="pollBox">
	<div class="LogList">
		<form method="post" id="addVoteForm" action="{:U('home/Vote/doAddVote')}" onsubmit="return check_vote();">
			<ul>
				<li>
					<div class="left alR" style="width: 15%;">{:L(add_0010)}：</div>
					<div class="left" style="width: 82%;">
						<input id="vote_title" name="title" type="text" class="in_put" style="width:70%" onblur="this.className='in_put'" onfocus="this.className='in_put2'" maxlength="30"/> 
						<a id="tog_explain" href="javascript:void(0)">{:L(add_0002)}</a>
					</div>
					<div class="C"></div>
				</li>
				<li id="vote_explain_button" style="display:none;">
					<div class="left alR" style="width: 15%;">{:L(add_0009)}：</div>
					<div class="left" style="width: 82%;">
						<textarea id="vote_explain" name="explain" rows="5" class="Text"  style="width:70%" onblur="this.className='in_put'" onfocus="this.className='in_put2'"></textarea>
					</div>
					<div class="C"></div>
				</li>
				<li><div class="lineB_D_D"></div></li>

				  <!-- 选项 BEGIN -->
				  <li id="vote_default">
						<div class="left alR" style="width: 15%;">{:L(add_0017)} 1：</div>
						<div class="left" style="width: 82%;">
						  <input name="opt[]" type="text" class="in_put vote_opt" id="textfield3" style="width:70%" onblur="this.className='in_put vote_opt'" onfocus="this.className='in_put2 vote_opt'" maxlength="30"/>
						</div>
						<div class="C"></div>
				  </li>
				  <li>
						<div class="left alR" style="width: 15%;">{:L(add_0017)} 2：</div>
						<div class="left" style="width: 82%;">
						  <input name="opt[]" type="text" class="in_put vote_opt" id="textfield3" style="width:70%" onblur="this.className='in_put vote_opt'" onfocus="this.className='in_put2 vote_opt'" maxlength="30"/>
						</div>
						<div class="C"></div>
				  </li>
				  <li>
						<div class="left alR" style="width: 15%;">{:L(add_0017)} 3：</div>
						<div class="left" style="width: 82%;">
						  <input name="opt[]" type="text" class="in_put vote_opt" id="textfield3" style="width:70%" onblur="this.className='in_put vote_opt'" onfocus="this.className='in_put2 vote_opt'" maxlength="30"/>
						</div>
						<div class="C"></div>
				  </li>
				  <li>
						<div class="left alR" style="width: 15%;">{:L(add_0017)} 4：</div>
						<div class="left" style="width: 82%;">
						  <input name="opt[]" type="text" class="in_put vote_opt" id="textfield3" style="width:70%" onblur="this.className='in_put vote_opt'" onfocus="this.className='in_put2 vote_opt'" maxlength="30"/>
						</div>
						<div class="C"></div>
				  </li>
				  <li>
						<div class="left alR" style="width: 15%;">{:L(add_0017)} 5：</div>
						<div class="left" style="width: 82%;">
						  <input name="opt[]" type="text" class="in_put vote_opt" id="textfield3" style="width:70%" onblur="this.className='in_put vote_opt'" onfocus="this.className='in_put2 vote_opt'" maxlength="30"/>
						</div>
						<div class="C"></div>
				  </li>
				  <li id="vote_more_options"><div class="lineB_D_D"></div></li>
				  <li>
						<div class="left alR" style="width: 15%;">&nbsp;</div>
						<div class="left" style="width: 82%;"><a id="add_more" href="javascript:more()">{:L(add_0004)}</a></div>
						<div class="C"></div>
				  </li>
				  <li>
					<div class="left alR" style="width: 15%;">{:L(add_0008)}：</div>
					<div class="left" style="width: 82%;">
						<select id="vote_type" name="type" class="in_put_01">
						  <option value="0">{:L(add_0022)}</option>
						  <option value="1">{:L('add_00162')}</option>
						  <option value="2">{:L('add_00163')}</option>
						  <option value="3">{:L('add_00164')}</option>
						  <option value="4">{:L('add_00165')}</option>
						</select>
					</div>
					<div class="C"></div>
				  </li>
				  <li>
					<div class="left alR" style="width: 15%;">{:L(add_0007)}：</div>
					<div class="left" style="width: 82%;">
					    <input type="radio" class="deadline_type" name="deadline_type" id="deadline_type_7" value="7" checked="checked"/> {:L(add_0028)} 
						<input type="radio" class="deadline_type" name="deadline_type" id="deadline_type_30" value="30" /> {:L(add_0015)} 
						<input type="radio" class="deadline_type" name="deadline_type" id="deadline_type_u" value="u" /> {:L(add_0029)} <!-- TODO 灰色 -->
						<select name="year" id="vote_year" class="in_put_01">
							<option value="{$now_year}">{$now_year}</option>
							<option value="<php>echo $now_year+1;</php>"><php>echo $now_year+1;</php></option>
							<option value="<php>echo $now_year+2;</php>"><php>echo $now_year+2;</php></option>
						</select>
						{:L(year)}
						<select name="month" id="vote_month" class="in_put_01">
							<php>$month = array(1,2,3,4,5,6,7,8,9,10,11,12);</php>
							<volist name="month" id="vo">
								<option value="{$vo}" <php>if($vo==$now_month){</php>selected="selected"<php>}</php>>{$vo}</option>
							</volist>
						</select>
						{:L(month)}
						<select name="day" id="vote_day" class="in_put_01">
							<php>$day = array(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30);</php>
							<volist name="day" id="vo">
								<option value="{$vo}" <php>if($vo==$now_day){</php>selected="selected"<php>}</php>>{$vo}</option>
							</volist>
						</select>
						{:L(day)}
						<!-- 
							<select  style="width: 42px;" name="month" id="vote_month" class="in_put_01">
								<php>$month = array(1,2,3,4,5,6,7,8,9,10,11,12);</php>
								<volist name="month" id="vo">
									<option value="{$vo}" <php>if($vo==$now_month){</php>selected="selected"<php>}</php>>{$vo}</option>
								</volist>
							</select>
							月
							<select style="width: 42px;" name="day" id="vote_day" class="in_put_01">
								<php>for($i=1;$i <= date('t');$i++) {</php>
									<option value="{$i}" <php>if($i==$now_day){</php>selected="selected"<php>}</php>>{$i}</option>
								<php>}</php>
							</select>
							日
						-->
					</div>
					<div class="C"></div>
				  </li>
				  <li>
					<div class="left alR" style="width: 15%;">{:L(add_0006)}：</div>
					<div class="left" style="width: 82%;">
						<input type="radio" class="is_anonymous" name="is_anonymous" value="0" checked="checked"/>{:L(add_0027)} 
						<input type="radio" class="is_anonymous" name="is_anonymous" value="1"/>{:L(add_0026)} 
					</div>
					<div class="C"></div>
				  </li>
				  <eq name="type" value="1">
				  <li>
					<div class="left alR" style="width: 15%;">&nbsp;</div>
					<div class="left" style="width: 82%;">
						<input type="submit" class="btn_sea" value="{:L(add_0012)}" />
					</div>
					<div class="C"></div>
				  </li>
				  </eq>
			</ul>
		</form>
	</div> <!-- LogList end  -->
</div>

